package DataStructures;

public class Card {

	private int suit;
	private int rank;
	
	private String[] suits = {"H", "C", "S", "D"};
	private String[] ranks = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"};
	
	public Card(int rank, int suit){
		if(rank<0 || rank>13){
			throw new IllegalArgumentException("A Card must have a rank between 0 and 13, the value " + rank + " is not valid");
		}
		if(suit<0 || suit>3){
			throw new IllegalArgumentException("A Card must have a suit between 0 and 3, the value " + suit + " is not valid");
		}
		this.rank = rank;
		this.suit = suit;
		
	}
	
	public String toString(){
		return ranks[rank] + suits[suit];
	}
	
	public boolean equals(Card card){
		boolean result = false;
		if((card.toString()).equals(this.toString())){
			result = true;
		}else{
			result = false;
		}
		return result;
	}
	
	public int getRank(){
		return rank;
	}
	
	public String getSuit(){
		return suits[suit];
	}
	
	
	public static void main(String[] args){
		Card c = new Card(5,2);
		System.out.println(c);
	}
}
